<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{{ obj.user.username }}个人资料</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport"
          name="viewport">
    {% include 'public_css.html' %}
    <style>
        .leftbar {
            background-color: #3D4F5D;
        }
    </style>
</head>

<body style="background-color:#ADADAD;">


<div class="am-offcanvas" id="left_bar">


    <div class="am-offcanvas-bar" id="left_bar">
        <div class="am-offcanvas-content">
            {% include 'leftbar.html' %}
        </div>
    </div>
</div>


<div class="am-g">

    <div data-am-sticky>
        <!-- header -->
        <div data-am-sticky align="center">
            <header class="am-topbar" style="background-color:gray;">

                <div class="am-topbar-left am-u-sm-1 am-u-md-1">
                    <a class="am-btn am-btn-sm am-btn-warning am-topbar-btn" href="#"
                       data-am-offcanvas="{target: '#left_bar', effect: 'push'}">
                        <font color="#FFFFFF"> <span class="am-icon-bars"></span></font>
                    </a>
                </div>
                <div class="am-topbar-left am-u-sm-10" style="float: right;margin-right: 5%;padding-top: 5px">
                    <a href="javascript:void(0)" onclick="location.reload()"><font size="5"
                                                                                   color="white">{{ obj.user.username }}个人简介</font>
                    </a></div>
            </header>
        </div>
    </div>


    <br>
    <br>
    <!--中-->
    {% if obj.login %}
        <div class="am-u-md-7">
            <form id="user_info_form" action="" method="POST" class="am-form am-form-horizontal">


                <div class="am-form-group">
                    <label for="user-name" class="am-u-sm-3 am-form-label">姓名 / Name</label>

                    <div class="am-u-sm-9">
                        <input type="text" id="user_name" name="user_name" placeholder="姓名 / Name"
                               value="{{ obj.user.username }}">

                    </div>
                </div>

                <div class="am-form-group">
                    <label for="user-email" class="am-u-sm-3 am-form-label">电子邮件 / Email</label>

                    <div class="am-u-sm-9">
                        <p id="user_email" name="user_email" placeholder="输入你的电子邮件 / Email"
                           align="left">{{ obj.user.email }}</p>

                    </div>
                </div>

                <div class="am-form-group">
                    <label for="user-phone" class="am-u-sm-3 am-form-label">电话 / Telephone</label>

                    <div class="am-u-sm-9">
                        <input type="text" id="user_phone" name="user_phone" placeholder="输入你的电话号码 / Telephone"
                               value="{{ obj.user.tel_number }}">
                    </div>
                </div>

                <div class="am-form-group">
                    <label for="user-QQ" class="am-u-sm-3 am-form-label">QQ</label>

                    <div class="am-u-sm-9">
                        <input type="text" id="user_QQ" name="user_QQ" placeholder="输入你的QQ号码"
                               value="{{ obj.user.qq_number }}">
                    </div>
                </div>

                <div class="am-form-group">
                    <label for="user-weibo" class="am-u-sm-3 am-form-label">微博 / Twitter</label>

                    <div class="am-u-sm-9">
                        <input type="text" id="user_weibo" name="user_weibo" placeholder="输入你的微博 / Twitter"
                               value="{{ obj.user.weibo_number }}">
                    </div>
                </div>

                <div class="am-form-group">
                    <label for="user-intro" class="am-u-sm-3 am-form-label">简介 / Intro</label>

                    <div class="am-u-sm-9">
                        <textarea class="" rows="5" id="user_intro" name="user_intro"
                                  placeholder="输入个人简介">{{ obj.user.introduction }}</textarea>

                        <p id="textarea_tip"></p>
                    </div>
                </div>

                <div class="am-form-group">
                    <div class="am-u-sm-9 am-u-sm-push-3">

                        <button type="submit" onclick="submitForm()" class="am-btn am-btn-warning">保存修改</button>
                        <div>{{ obj.tip_for_save }}</div>


                    </div>
                </div>
                <!--csrf-->
                {% csrf_token %}
            </form>

        </div>
    {% else %}
        <div class="am-u-md-7">
            <table class="am-table" style="background-color:white;">

                <tbody>
                <tr class="am-primary">
                    <td>姓名 / Name</td>
                    <td>{{ obj.user.username }}</td>

                </tr>
                <tr class="am-success">
                    <td>电子邮件 / Email</td>
                    <td>{{ obj.user.email }}</td>

                </tr>
                <tr class="am-danger">
                    <td>电话 / Telephone</td>
                    <td>{{ obj.user.tel_number }}</td>

                </tr>
                <tr class="am-warning">
                    <td>QQ</td>
                    <td>{{ obj.user.qq_number }}</td>

                </tr>
                <tr class="am-active">
                    <td>微博 / Twitter</td>
                    <td>{{ obj.user.weibo_number }}</td>

                </tr>
                <tr class="am-default">
                    <td>简介 / Intro</td>
                    <td>{{ obj.user.introduction }}</td>

                </tr>


                </tbody>
            </table>
        </div>
    {% endif %}


    <!--右-->
    <div class="am-u-md-5">
        <div class="am-panel am-panel-success">
            <div class="am-panel-hd">头像</div>
            <div class="am-panel-bd">
                <div class="am-g">

                    <div class="am-u-md-12" align="center" style="margin-bottom:20px">

                        <img class="am-comment-avatar " src="{{ obj.user.head_img_url }}" alt=""/>

                    </div>

                    {% if obj.login %}
                        <div class="am-u-md-12">
                            <form id='upload_form' action="./head_img_upload/" class="am-form" method="POST"
                                  enctype="multipart/form-data">
                                <div class="am-form-group">
                                    <input type="file" name="headimg">

                                    <p class="am-form-help">请选择要上传的文件...</p>
                                    <button class="am-btn am-btn-success" type="submit">上传文件</button>
                                </div>
                                {% csrf_token %}
                            </form>
                        </div>


                    {% endif %}


                </div>
            </div>
        </div>


    </div>

    <div class="am-u-md-5">
        <div class="am-panel am-panel-primary">
            <div class="am-panel-hd">项目经验</div>
            <div class="am-panel-bd">
                <div class="am-g">
                    <div class="am-u-md-12">
                        {% if obj.login %}

                            <form id='giturl_form' action="./headimgupload/" class="am-form" method="POST"
                                  enctype="multipart/form-data">
                                <div class="am-form-group">
                                    <input type="text" name="giturl" value="https://git.oschina.net/Lovejingru">

                                    <p>
                                        <button class="am-btn am-btn-primary" type="submit">保存</button>
                                    </p>
                                </div>
                                {% csrf_token %}
                            </form>
                        {% else %}
                            <p><label>git地址</label><a href="https://git.oschina.net/Lovejingru" target="_blank">https://git.oschina.net/Lovejingru</a>
                            </p>
                            <p><label>网易博客</label><a href="http://m13560418496.blog.163.com" target="_blank">http://m13560418496.blog.163.com</a>
                            </p>
                        {% endif %}
                    </div>
                </div>

            </div>
        </div>


    </div>

</div>

<script>
    function submitForm() {
        $('#user_info_form').submit();
    }
</script>

</body>
{% include 'public_js.html' %}
</html>